package com.uphone.kingmall.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatDialog;

import com.china.zhuoyue.R;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * <pre>
 *     author : 孙增艳
 *     e-mail : sunzengyan@outlook.com
 *     time   : 2019/2/25
 *     desc   : 取消订单dialog
 *     version: 1.0
 * </pre>
 */
public class CancelOrderDialog extends AppCompatDialog {
    private final OnClickListener onClickListener;

    public CancelOrderDialog(Context context, OnClickListener onClickListener) {
        super(context);
        this.onClickListener = onClickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.kingmall_dialog_cancel_order);
        setCanceledOnTouchOutside(false);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.tv_cancel, R.id.tv_confirm})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_cancel:
                dismiss();
                break;
            case R.id.tv_confirm:
                onClickListener.onConfirmClick();
                dismiss();
                break;
            default:
                break;
        }
    }

    public interface OnClickListener {
        void onConfirmClick();
    }
}
